import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

class Layout extends StatelessWidget {
  final StatefulNavigationShell navigationShell;

  Layout({super.key, required this.navigationShell});

  // tabbar
  final List<BottomNavigationBarItem> items = [
    BottomNavigationBarItem(icon: Icon(Icons.abc_outlined), label: "HOME"),
    BottomNavigationBarItem(icon: Icon(Icons.abc_outlined), label: "CASE"),
    BottomNavigationBarItem(icon: Icon(Icons.abc_outlined), label: "MY"),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
       
        bottomNavigationBar: BottomNavigationBar(
          items: items,
          currentIndex: navigationShell.currentIndex,
          onTap: (value) => navigationShell.goBranch(
            value,
            initialLocation: true, //为true默认每次切换都是tabbar页面
          ),
        ),
        body: navigationShell);
  }
}
